package org.ehe.business.bom.service;

import com.baomidou.mybatisplus.extension.service.IService;
import org.ehe.business.bom.domain.BomChangeLog;
import org.ehe.business.bom.domain.bo.BomChangeLogBo;
import org.ehe.business.bom.domain.vo.BomChangeLogVO;
import org.ehe.common.mybatis.core.page.PageQuery;
import org.ehe.common.mybatis.core.page.TableDataInfo;

import java.util.List;
import java.util.Map;

/**
 * bom改变日志实现类
 * @author :zhangnn
 * @className :BomChangeLogService
 * @description: TODO
 * @date 2025-07-30 13:54:40
 */
public interface BomChangeLogService extends IService<BomChangeLog> {
    /**
     * 创建BOM变更记录
     * @param changeLog
     * @return
     */
    BomChangeLog createChangeRequest(BomChangeLog changeLog);

    /**
     * 生成变更影响分析报告
     * @param changeLog
     * @return
     */
    String generateImpactAnalysis(BomChangeLog changeLog);

    /**
     * 实施变更
     * @param changeLogId
     */
    void implementChange(Long changeLogId);

    /**
     * 根据BOM ID查询变更记录
     * @param bomId
     * @return
     */
    List<BomChangeLog> getChangeLogsByBomId(Long bomId);

    /**
     * 获取变更统计信息
     * @param bomId
     * @return
     */
    Map<String, Object> getChangeStatistics(Long bomId);

    /**
     * 提交变更审批
     * @param changeLogId
     * @param workflowInstanceId
     */
    void submitChangeForApproval(Long changeLogId, Long workflowInstanceId);

    /**
     * 审批通过
     * @param changeLogId
     * @param approverId
     * @param approverName
     * @param approvalComments
     */
    void approveChange(Long changeLogId, Long approverId, String approverName, String approvalComments);

    /**
     * 审批拒绝
     * @param changeLogId
     * @param approverId
     * @param approverName
     * @param rejectReason
     */
    void rejectChange(Long changeLogId, Long approverId, String approverName, String rejectReason);

    /**
     * 撤销变更请求（仅限申请人在待审批状态下操作）
     * @param changeLogId
     * @param applicantId
     */
    void withdrawChange(Long changeLogId, Long applicantId);

    /**
     * 变更详情
     * @param id
     * @return
     */
    BomChangeLogVO getChangeLogDetail(Long id);

    /**
     * 批量审批BOM变更
     * @param changeLogIds
     * @param approverId
     * @param approverName
     * @param batchComments
     */
    void batchApproveChanges(List<Long> changeLogIds, Long approverId, String approverName, String batchComments);

    /**
     * 批量拒绝BOM变更
     * @param changeLogIds
     * @param approverId
     * @param approverName
     * @param rejectReason
     */
    void batchRejectChanges(List<Long> changeLogIds, Long approverId, String approverName, String rejectReason);

    /**
     * 根据变更状态查询变更记录
     * @param changeStatus
     * @return
     */
    List<BomChangeLog> getChangeLogsByStatus(Integer changeStatus);

    /**
     * 创建变更内容JSON
     * @param changeData
     * @return
     */
    String createChangeContentJson(Map<String, Object> changeData);

    /**
     * 分页
     * @param bo
     * @param pageQuery
     * @return
     */
    TableDataInfo<BomChangeLogVO> pageChangeLogs(BomChangeLogBo bo, PageQuery pageQuery);
}
